package com.caption.support;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

/**
 * 获取交易链路变量
 */
public class DefaultTxContext implements TxContext{
    private final Map<String,String> attributes = new HashMap<>();
    @Override
    public TxContext add(String key, String value) {
        attributes.put(key,value);
        return this;
    }

    @Override
    public String get(String key) {
        return attributes.get(key);
    }

    @Override
    public TxContext remove(String key) {
        attributes.remove(key);
        return this;
    }

    @Override
    public Map<String, String> getAttributes() {
        return Collections.unmodifiableMap(attributes);
    }

}
